﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>后勤保障平台</title>
    <link href="@Url.Content("~/Themes/Default/layout.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/Default/tabpanel.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/Default/dailog.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/Default/tree.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/Default/main.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Themes/Default/mainw.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/plugins_source/jquery.form.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/plugins_source/jquery.tree.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/plugins_source/jquery.tabpanel.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/plugins_source/jquery.ifrmdailog.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.easydrag.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {

            //---------------------------------------
            //设置页面最大化
            //---------------------------------------
            //debugger;
            window.moveTo(0, 0);
            window.resizeTo(screen.width, screen.height);
            setSize();

            getModularByLog();

            $("#separatorBtn").click(function () {
                $("#leftTree").toggle();
                if ($(this).hasClass("separatorBtn1")) {
                    $(this).addClass("separatorBtn2");
                    $(this).removeClass("separatorBtn1");
                    $("#tab-container").width($(window).width() - $("#separator").width());

                } else {
                    $(this).removeClass("separatorBtn2");
                    $(this).addClass("separatorBtn1");
                    $("#tab-container").width($(window).width() - $("#leftTree").width() - $("#separator").width());
                }
            });

            $(window).resize(function () {
                setSize();
                setContainerSize();
            });
            loadTree(document.firstmodularid);
            var whh = document.workhh + 'px';
            var tabo = {};
            var $html = new Array();
            $html.push("<div style=' height:" + whh + "; width:auto;background:url(../Images/picture/mainIndex_bg.jpg) no-repeat right top; '>");
            $html.push("<div style='position:absolute;left:50%;top:50%;font-size:26px;color:#142e6b;margin-top:-100px;margin-left:-150px;'>");
            $html.push("欢迎进入后勤保障平台!");
            $html.push("</div></div>");
            tabo.items = [{ id: "home", text: "主页", classes: "icon_home", isactive: true, content: $html.join("")}];
            tabo.width = "auto";
            tabo.height = $(".middle").height() - 2;
            $("#tab-container").tabpanel(tabo);
            $("#AqExit").click(function () {
                window.opener = null;
                window.open("", "_self");
                window.close();
            });
        });


        function setSize() {
            $(".middle").height($(window).height() - $("#header").height() - $("#tipMenu").height() - $("#footer").height());
            document.workhh = $(".middle").height() - 30;
            $("#rightCon").height($(window).height() - $("#header").height() - $("#tipMenu").height() - $("#footer").height());
        }


        function setContainerSize() {
            $("#tab-container").height($(".middle").height()).width($(window).width()
                                                    - $("#leftTree").width() - $("#separator").width());
        }


        function loadTree(moid) {
            $.ajax({
                url: '@Url.Action("Menu")',
                type: "POST",
                data: { moid: moid },
                success: function (callback) {
                    if (callback) {
                        var op = { data: callback, onnodeclick: navi };
                        $("#treepanel").treeview(op);
                    } else {

                    }
                },
                error: function () {
                    showLoadingMsg("操作失败！", { left: 200, top: 2 }, true, 3000);
                }
            });
        }

        function idreplace(id) {
            return id.replace(/[^a-zA-Z\d_]/ig, "_")
        }

        function navi(item) {
            if (item.hasChildren) {
                item.expand();
            }
            else if (item.value != "\'\'") {
                $("#tab-container").opentabitem({
                    id: idreplace(item.id),
                    text: item.text,
                    url: item.value,
                    isactive: true,
                    closeable: true
                }, true);
            } else { }
        }

        //----------------------------------------
        // 根据登录用户名称获取模块
        //----------------------------------------
        function getModularByLog() {
            var strhml = new Array();
            $.ajax({
                type: "POST",
                url: '@Url.Action("GetModularByLog")',
                data: {},
                dataType: "json",
                async: false,
                success: function (msg) {
                    if (msg) {
                        $.each(msg, function (i, item) {
                            var moid = item.ModularId;
                            if (i == 0) { document.firstmodularid = moid }
                            strhml.push("<div class='items'>");
                            strhml.push("<div class='item itemLeft'></div>");
                            strhml.push("<div class='item itemCon'>");
                            strhml.push("<a href='javascript:loadTree(" + moid + ");'>" + item.ModularName + "</a>");
                            strhml.push("</div>");
                            strhml.push("<div class='item itemRight'>");
                            strhml.push("</div>");
                            strhml.push("</div>");
                        });
                        $("#menuCon").html(strhml.join(""));
                    } // end of if
                },
                error: function () { }
            });    // end of ajax                
        }
    </script>
</head>
<body>
    <div id="wrapper">
        <div id="header">
            <div id="logo">
            </div>
            <div id="menu">
                <div id="menuCon">
                </div>
            </div>
        </div>
        <div id="tipMenu">
            <div id="userHeader">
            </div>
            <div id="userWelcomeInfo">
                当前登录用户：<span> admin(超级管理员) </span>您好，欢迎光临。
            </div>
            <div id="userHandler">
                <a href="#">管理中心</a>|<a id="AqExit1" href="../Account/LogOn">安全退出</a>
            </div>
            <div>
            </div>
        </div>
        <div id="contanier">
            <div class="middle" id="leftTree">
                <div id="panel-header" class="x-panel-header">
                    <span class="menupanel">菜单 </span>
                </div>
                <div class="x-panel-bwrap">
                    <div id="panel-wrap" class="x-panel-body">
                        <div id="treepanel" class="menutree">
                            <!--menu tree -->
                        </div>
                    </div>
                </div>
            </div>
            <div class="middle" id="separator">
                @*<div id="separatorBtn" class="separatorBtn1">
                </div>*@
            </div>
            <div class="middle" id="rightCon">
                <div id="tab-container">
                </div>
            </div>
        </div>
        <div id="footer">
            <p>
                Copyright © 2011 All rights reserved 上海国际港务（集团）股份有限公司振东集装箱码头分公司
            </p>
        </div>
    </div>
</body>
</html>
